<h2>User Report</h2>
<table class="list-display">
  <tr>
    <th width=120 align=left>Username</th>
    <th width=200 align=left>Name</th>
    <th width=100 align=left>Posts</th>
    <th width=100 align=left>Replies</th>
    <th width=100 align=left>Votes</th>
    <th></th>
  </tr>
  <% @users.sort! { |u1, u2| u1.name <=> u2.name } %>
  <% @users.each do |user| %>
      <% num_votes = user.votes.count
         num_posts = 0
         num_replies = 0
         user.posts.each do |post|
             post.post_id.nil? ? num_posts += 1 : num_replies += 1
         end %>
      <tr>
        <td><%= user.username %></td>
        <td><%= user.name %></td>
        <td><%= num_posts %></td>
        <td><%= num_replies %></td>
        <td><%= num_votes %></td>
        <td><%= link_to 'Details', details_user_path(user) %></td>
      </tr>
  <% end %> </table>  <br/>
